package ui.component {

	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import globals.Global;
	
	public class Grid extends Sprite {
		
		private var frame:Bitmap;
		private var icon:Bitmap;
		private var count:TextField;
		public var handler:Function;
		public var bag:uint;
		public var index:uint;
		
		public static const SIZE:uint = 66;

		public function Grid(iconKey:String = "") {
			super();
			
			frame = new Bitmap();
			addChild(frame);
			icon = new Bitmap();
			icon.x = icon.y = 3;
			addChild(icon);
			
			update(iconKey);
		}
		
		public function update(iconKey:String):void {
			if (iconKey == "") {
				icon.bitmapData = Global.assetsManager.getIconBitmapData("2000");
				frame.bitmapData = Global.assetsManager.getAssetsAsBitmapData("border_blank");
				buttonMode = false;
			} else {
				icon.bitmapData = Global.assetsManager.getIconBitmapData(iconKey);
				frame.bitmapData = Global.assetsManager.getAssetsAsBitmapData("border");
				buttonMode = true;
			}
		}
		
		public function clear():void {
			frame.bitmapData = icon.bitmapData = null;
		}
	}
}